<template>
  <div class="right-activity-item" @click="onDetail(data)" :style="{backgroundImage: 'url(' + data.coverUrl + ')'}">
    <div class="play-icon" v-if="data.liveUrl"></div>
    <div class="title-box">
      <div class="title">{{data.name}}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    data: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    onDetail(item) {
      if (item.liveUrl) {
        window.open(item.liveUrl, '_blank');
      } else {
        let routerJump = this.$router.resolve({ name: 'ActivityDetail', query: {uuid: item.resId} });
        window.open(routerJump.href, '_blank');
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.right-activity-item {
  width: 100%;
  height: 212px;
  background-size: cover;
  margin-bottom: 20px;
  position: relative;
  border-radius: 4px;
  cursor: pointer;
  .play-icon {
    width: 60px;
    height: 60px;
    background: url('../../../assets/play-icon.png') no-repeat;
    background-size: cover;
    position: absolute;
    top: 66px;
    left: 50%;
    margin-left: -30px;
  }
  .title-box {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    background: linear-gradient(-180deg,transparent,rgba(0,0,0,.65) 97%);
    border-radius: 0px 0px 4px 4px;
    position: absolute;
    left: 0;
    bottom: 0;
    .title {
      font-size: 18px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: #FFFFFF;
      line-height: 24px;
      max-height: 48px;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      overflow: hidden;
    }
  }
}
</style>